package com.shopnight.redisEntity;

import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 购物项
 */
@Data
public class CartItem {
    private Long orderId;              //商品id
    private String orderName;
    private String imgUrl;
    private BigDecimal price;         //商品原价
    private Integer orderNum ;              //商品数量
    private BigDecimal purchasePrice;      //最终价格
    private BigDecimal priceDiscounts  ;  //商品优惠价
    private BigDecimal priceSeckill ;   //商品秒杀价

    private BigDecimal priceCut;  //阶级  忽略
    private Integer stockCount;  //库存数量


    private Boolean check ;     //选中状态
    private Boolean seckill ; //状态 是否秒杀
    private Long orgId;    //商品组织id

    private Date createTime; //更新时间

    public BigDecimal getPurchasePrice() {
        if (seckill){
            return this.priceSeckill.multiply(new BigDecimal(""+this.orderNum));
        }else {
            return this.priceDiscounts.multiply(new BigDecimal(""+this.orderNum));
        }
    }


}
